encoding categorical data
Encoding Categorical Data in R for Data Science - Detechtor
We've learned how to install R and RStudio, import the dataset, and take care of missing data using the R language. Now I'm going you show you how to encode categorical data in R. If you take a look at our dataset, you'll see that we have two categorical variables. We have the county variables – Nairobi, Kisumu, and Mombasa – and we have the Purchased variables – Yes and No. They're categorical variables, obviously because they have categories. Since machine learning models are based on mathematical/numerical equations, keeping the text in the categorical variables would definitely cause us some problems. We want to have'numbers only' in our equations.
Country:
- Africa > Kenya > Nairobi City County > Nairobi (0.26)
- Africa > Kenya > Mombasa County > Mombasa (0.26)
- Africa > Kenya > Kisumu County > Kisumu (0.26)
- (3 more...)
Technology: